<?php include "inc/conn.php";?><?php include "inc/pubs.php";?>
<?php include "inc/safe.php";?><?php include "inc/sqls.php";?>
<?php
$th = $_COOKIE['name'];
$dn = $_COOKIE['pass'];
$act = trim($_POST["Act"]);
$pici = trim($_GET['pi']);
$ch =  trim($_POST['ch']);
$ename = trim($_POST['name']);
$ob = trim($_POST['sfzh']);
$ri = trim($_POST['es']);
//判断是否记忆登陆
If($dn == md5($th.$ao)){
}else{
//正式用途删除以下行首两斜杠
//exit("请刷新页面，重新登陆(A1)!");
}
$db=ConnectMysqli::getIntance($conn);
switch ($act) {
case "sfzh":
//身份证号规则验证
$ob = strtoupper($ob);
$regx = "/^(\d{6})+(\d{4})+(\d{2})+(\d{2})+(\d{3})([0-9]|X)$/";
@preg_match($regx, $ob, $arr_split);
$birx = $arr_split[1];
$dizs = file_get_contents("inc/sfzh.txt");
if(!stristr($dizs,$birx)){exit("请纠正:身份证1-6位($birx)错误！");}
$biry = $arr_split[2];
if($biry<1888 || $biry>date("Y")){exit("请纠正:身份证7-10位($biry)错误！");}
$birm = $arr_split[3];
if($birm<1 || $birm>12){exit("请纠正:身份证11-12位($birm)错误！");}
$bird = $arr_split[4];
if($bird<1 || $bird>31){exit("请纠正:身份证13-14位($bird)错误！");}
//检验18位身份证的校验码是否正确。按照ISO 7064:1983.MOD 11-2的规定生成
$arr_int = array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
$arr_ch = array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
$sign = 0;
for ( $i = 0; $i < 17; $i++ ){
$b = (int) $ob{$i};
$w = $arr_int[$i];
$sign += $b * $w;
}
$n = $sign % 11;
$val_num = $arr_ch[$n];
if ("@".$val_num != "@".substr($ob,17,1)){
exit("身份证尾号验证失败,请检查身份证是否输对！");
}
//身份证号已被他人（其他微信号）绑定
$sql="SELECT COUNT(*) FROM `{$no}` WHERE `{$lr}` <> '{$th}'";
$sql.=" AND `{$ur}` = '{$ob}'";
$list=$db->getRow($sql);
$recs=$list['COUNT(*)'];
//exit("预约失败(cv)：{$sql}!");
if($recs>0){
exit("该证件已其他微信号绑定(cv)!");
}
//查询登录微信是否X天内已预约
$sql="SELECT COUNT(*) FROM `{$no}` WHERE `{$lr}` = '{$th}'";
$sql.=" AND `{$dr}`>'{$ad}'";
//exit("预约失败(fe)：{$sql}!");
$list=$db->getRow($sql);
$recs=$list['COUNT(*)'];
if($recs>0){
exit("{$ng}天内不能重复预约(fe)!");
}
exit("0");
break;
case "ch":
//查询网点批次剩余数量
$sql="SELECT COUNT(*) FROM `{$no}` WHERE `{$tv}` = '{$ch}'";
$sql.=" AND `{$rf}` = '{$pici}'";
$sql.=" AND `isyue` < 1";
//exit("预约失败(ie)：{$sql}!");
$list=$db->getRow($sql);
$recs=$list['COUNT(*)'];
if($recs<1){
exit("{$ch} 已预约完毕!");
}else{
$wf = " WHERE `预约批次` = '{$pici}' AND `店铺名称` = '{$ch}' ";
$yl="SELECT `每份数量`,`每份付费` FROM `{$no}_shop` {$wf}";
$yl.=" limit 0, 1";
$wx=$db->getAll($yl);
echo "<span>{$ch}还剩{$recs}份可预约!</span><br>";
echo xt($wx);
exit("");
}
break;
default:
exit("STOP!");
}
?>